//
//  CAMoneyHeaderView.m
//  LNH
//
//  Created by twentylx on 2018/1/22.
//  Copyright © 2018年 twentylx. All rights reserved.
//

#import "CAMoneyHeaderView.h"

@implementation CAMoneyHeaderView

/**
 为视图绑定 viewModel
 
 @param viewModel 要绑定的ViewModel
 @param params 额外参数
 */
- (void)bindViewModel:(id <LMViewProtocol>)viewModel withParams:(NSDictionary *)params {
    
}


/**
 初始化额外数据
 */
- (void)lm_initializeForView {
    
}

/**
 初始化视图
 */
- (void)lm_createViewForView {
    [self addSubview:self.bgImageView];
    [self addSubview:self.moneyLabel];
    
    [self setNeedsUpdateConstraints];
}

#pragma mark layout
- (void) updateConstraints {
    [super updateConstraints];
    
    [_bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self);
    }];
    
    [_moneyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.and.right.equalTo(self);
        make.centerY.equalTo(self);
    }];
}

#pragma mark get & set
- (UIImageView *) bgImageView {
    if (!_bgImageView) {
        _bgImageView = [UIImageView new];
        _bgImageView.image = LMImageNamed(@"yue_bg");
    }
    return _bgImageView;
}

- (UILabel *) moneyLabel {
    if (!_moneyLabel) {
        _moneyLabel = [UILabel new];
        _moneyLabel.text = @"当前账户余额：300.00";
        _moneyLabel.font = [UIFont systemFontOfSize:20];
        _moneyLabel.textAlignment = NSTextAlignmentCenter;
        _moneyLabel.textColor = [UIColor whiteColor];
    }
    return _moneyLabel;
}

@end
